﻿@model IEnumerable<ArivisTests.Models.TestCase>
@using ArivisTests.Views;

@{
    int numTests = Model.Count();
    var groups = Model.GroupBy(x => x.Result).OrderBy(x => x.Key).ToList();
    int colWidth = 100 / groups.Count;
}

<table>
@foreach (var group in groups)
{
    int groupTests = group.Count();
    int percent = 100 * groupTests / numTests;
    <tr>
        <th style="width:1%;white-space:nowrap;padding-right:8px;">
            @MvcHtmlString.Create(group.Key == null ? "[no result]" : group.Key.Name)
        </th>
        <th style="text-align:left">
            @(percent)% (@groupTests / @numTests)
        </th>
    </tr>
    <tr>
        <td colspan="2" style="padding-bottom:1em;">@Html.LinkedItems("Edit", "TestCase", group.OrderBy(test => test.Order), false)</td>
    </tr>
}
</table>
